﻿/*
 * Copyright (c) HiSilicon (Shanghai) Technologies Co., Ltd. 2023-2023. All rights reserved.
 */

#ifndef YMODE_H
#define YMODE_H

namespace ModemName {
    const unsigned int MODEM_SOH = 0x01; // 数据块起始字符
    const unsigned int MODEM_STX = 0x02; // 1024字节开始
    const unsigned int MODEM_STXA = 0x0a; // 2048字节开始
    const unsigned int MODEM_STXB = 0x0b; // 4096字节开始
    const unsigned int MODEM_STXC = 0x0c; // 8192字节开始
    const unsigned int MODEM_EOT = 0x04; // 文件传输结束
    const unsigned int MODEM_ACK = 0x06; // 确认应答
    const unsigned int MODEM_NAK = 0x15; // 出现错误
    const unsigned int MODEM_CAN = 0x18; // 取消传输
    const unsigned int MODEM_C = 0x43; // 大写字母C
    const unsigned int MODEM_PACKET_SIZE = 1024;
    const unsigned int MODEM_PACKET_SIZEA = 2048;
    const unsigned int MODEM_PACKET_SIZEB = 4096;
    const unsigned int MODEM_PACKET_SIZEC = 8192;
}
using namespace ModemName;

namespace YModemClass {
class YModem {
public:
    YModem();
    ~YModem();

    static unsigned short GetCrc(const unsigned char *buf, unsigned int len);
};
}

#endif // YMODE_H
